package ecom.appcode.business;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.List;

import ecom.appcode.common.bean.OrderBean;
import ecom.appcode.common.bean.OrderDetailBean;
import ecom.appcode.common.daobean.OrderDaoBean;
import ecom.appcode.common.daobean.OrderDetailDaoBean;
import ecom.appcode.common.utility.DBUltils;
import ecom.appcode.dao.daointerface.OrderDetailDao;
import ecom.appcode.dao.daointerface.OrderDetailDaoImpl;

public class OrderDetailLogicImpl implements OrderDetailLogic {

    /** Insert Order Details */
    public boolean insertOrderDetails(int shoesID, int quantity, float unitPrice, float total, int orderID) {
        OrderDetailDao orderDao = new OrderDetailDaoImpl();
        boolean result = orderDao.insertOrderDetails(shoesID, quantity, unitPrice, total, orderID);
        return result;
    }

    /** SELECT BEST PRODUCT */
    public List<OrderDetailBean> selectBestProduct() {
        OrderDetailDao orderBean = new OrderDetailDaoImpl();
        List<OrderDetailBean> list = orderBean.selectBestProduct();
        return list;
    }

    /** SELECT ALL ORDER DETAIL */
    public List<OrderDetailDaoBean> viewAllOrderDetail() {
        OrderDetailDao orderBean = new OrderDetailDaoImpl();
        List<OrderDetailDaoBean> list = orderBean.viewAllOrderDetail();
        return list;
    }

    /** SELECT ALL ORDER DETAIL AND ORDER */
    public List<OrderBean> loadOrderAndDetail(){
        OrderDetailDao orderBean = new OrderDetailDaoImpl();
        List<OrderBean> list = orderBean.loadOrderAndDetail();
        return list;
    }
    
    /** Delete orderDaoBean */
    public boolean deleteOrderDetail(int ID) {
        OrderDetailDao orderBean = new OrderDetailDaoImpl();
        boolean result = orderBean.deleteOrderDetail(ID);
        return result;
    }
    
}
